package com.foreknow.demo4;

import java.util.Scanner;

/**
  找出数组中最大值的下标位置
 */
public class TestMethod9 {

    public static int maxIndex(int[] array) {
        int maxIndex = 0;
        for(int i = 1;i<array.length;i++) {
            if(array[maxIndex] < array[i]) {
                maxIndex = i;
            }
        }
        return maxIndex;
    }

    public static void main(String[] args) {
        int[] arr = {12,14,35,27,29};
        int m = maxIndex(arr);
        System.out.println(m);




        Scanner input = new Scanner(System.in);
        int[] array = new int[5];
        for(int i = 0;i<array.length;i++) {
            array[i] = input.nextInt();
        }
    }
}
